package com.example.chengche_lol.ui.news;

import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.chengche_lol.R;
import com.example.chengche_lol.adapter.NewsArticleAdapter;
import com.example.chengche_lol.base.BaseFragment;
import com.example.chengche_lol.beans.NewsArticleBean;


public class NewsArticleFragment extends BaseFragment {

    private RecyclerView mRecyclerView;
    private NewsArticleAdapter mAdapter;

    @Override
    protected int rootLayout() {
        return R.layout.fragment_news_article;
    }

    @Override
    protected void initView(View view) {
        mRecyclerView = view.findViewById(R.id.rv_content_list);
    }

    @Override
    protected void initData() {

        mAdapter = new NewsArticleAdapter();

        NewsArticleBean n1 = new NewsArticleBean("如何看待失足少男深夜使用花呗消费高额化妆品，购买名牌服饰这一社会现象",R.drawable.huabei,"Vsinger官方","老V","124479");
        mAdapter.addData(n1);
        NewsArticleBean n2 = new NewsArticleBean("日本某绿发四字女明星疑似被曝私下与粉丝约会，并消费大量菜市场的葱",R.drawable.mikudate,"初音未来_Crypton","初音未来","4897465");
        mAdapter.addData(n2);
        NewsArticleBean n3 = new NewsArticleBean("根据Vsinger动物园的饲养员口述，近期园内时常发生竹子被盗事件，监控录像显示案犯为黑白相间发色",R.drawable.longya,"Vsinger官方","乐正龙牙","7849");
        mAdapter.addData(n3);
        NewsArticleBean n4 = new NewsArticleBean("我国著名红色歌姬登场2021年中央电视台春节联欢晚会并且一直在天上飞",R.drawable.tianyifei,"Vsinger官方","洛天依","988888");
        mAdapter.addData(n4);
        NewsArticleBean n5 = new NewsArticleBean("Piapro Character出版社的编辑表示，某15岁男明星与某K姓男歌手疑似在北海道同泡温",R.drawable.kaitolen,"初音未来_Crypton","镜音连","683473");
        mAdapter.addData(n5);
        NewsArticleBean n6 = new NewsArticleBean("日前，海鲜市场上的章鱼不断涨价，涨价原因暂时不明，可能与某粉发女星有关",R.drawable.luka,"初音未来_Crypton","巡音流歌","3467845");
        mAdapter.addData(n6);

    }

    @Override
    protected void bindData() {

        super.bindData();
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        mRecyclerView.setAdapter(mAdapter);

    }

    @Override
    protected void bindEvent() {

    }
}
